package com.lc.stock.exception;

/**
 * 通用 exception
 * 主要用于带事务的逻辑  抛出异常  使其回滚
 */
public class ResultException extends RuntimeException {

    private Integer errorCode;

    private String message;

    private Object object;

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Integer getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(Integer errorCode) {
        this.errorCode = errorCode;
    }

    public Object getObject() {
        return object;
    }

    public void setObject(Object object) {
        this.object = object;
    }

    public ResultException(String message) {
        super(message);
        this.errorCode = 400;
        this.message = message;
    }

    public ResultException(Integer errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
        this.message = message;
        this.object = null;
    }

    public ResultException(Integer errorCode, String message, Object object) {
        super(message);
        this.errorCode = errorCode;
        this.message = message;
        this.object = object;
    }
}
